
import { IsString, IsNumber, IsBoolean, IsDate, IsOptional, IsEnum, IsArray } from 'class-validator';
import { ApiProperty, OmitType, IntersectionType } from '@nestjs/swagger';
import { PagingDto } from 'src/common/dto/index';
import { CharEnum } from 'src/common/enum/index';
import { Type } from 'class-transformer';


export class BaseSessionDto{
	@ApiProperty({required: false , description: '会话ID，用于关联同一场对话'})
	@IsOptional()
	@IsNumber()
	@Type(() => Number)
	id?: number;

	@ApiProperty({required: false , description: '用户ID'})
	@IsOptional()
	@IsNumber()
	@Type(() => Number)
	userId?: number;

	@ApiProperty({required: false , description: '会话标题'})
	@IsOptional()
	@IsString()
	title?: string;

	@ApiProperty({enum: CharEnum, required: false , description: '删除标志'})
	@IsOptional()
	@IsString()
	delFlag?: string;

	@ApiProperty({required: false , description: '创建时间'})
	@IsOptional()
	@IsArray()
	@IsString({ each: true })
	createTime?: Array<string>;

	@ApiProperty({required: false , description: '更新时间'})
	@IsOptional()
	@IsArray()
	@IsString({ each: true })
	updateTime?: Array<string>;

}

export class CreateSessionDto extends OmitType(BaseSessionDto, ['id','delFlag','createTime']){}

export class UpdateSessionDto extends OmitType(BaseSessionDto, ['delFlag','createTime']){}

export class QuerySessionDto extends IntersectionType(BaseSessionDto, PagingDto){}

export class ListSessionDto extends OmitType(BaseSessionDto, ['delFlag','createTime','updateTime']){}
